import http from '../../utils/http'
const app = getApp()
Page({

    data: {
        swpLis: [],
        gridLis: [],
        shopLis: [],
        ipval: ''
    },
    inputval(e) {
        this.setData({
            ipval: e.detail.value
        })
    },
    changeVal() {
        this.setData({
            ipval: 'hello'
        })
    },
    getSwpLis() {
        wx.request({
            url: 'https://www.escook.cn/slides',
            method: 'GET',
            success: (res) => {
                this.setData({
                    swpLis: res.data
                })
            }
        })
    },
    getGridLis() {
        wx.request({
            url: 'https://www.escook.cn/categories',
            method: 'GET',
            success: (res) => {
                this.setData({
                    gridLis: res.data
                })
            }
        })
    },
    gotoSp() {
        app.globalData.msg = this.data.ipval
        console.log(app.globalData);
        wx.navigateTo({
            url: '/pages/shops/shops',
        })
    },
    onLoad: function (options) {

        this.getSwpLis();
        this.getGridLis();
        //    wx.login({
        //      success: async (res) => {
        //          wx.setStorageSync('uinfo', res.code)
        //          const res= await http('/categories',{islogin:true})

        //      },
        //    })
    },
    gotoLink() {
        wx.navigateTo({
            url: '/pages/link/link',
        })
    },
    clickView() {
        console.log('view被点了');
    },
    showPopup() {
        this.setData({
            show: true
        });
    },

    onClose() {
        this.setData({
            show: false
        });
    },
})